package com.candy.homework;

/**
 * @author donglin
 * @Title:
 * @类名: SalesEmployee
 * @date 2020/7/24
 */
public class SalesEmployee extends ColEmployee{
   // （4）SalesEmployee ：ColaEmployee 的子类，
    // 销售人员，工资由月销售额和提成率决定。
    // 属性：月销售额、提成率
    double monthSales;
    double reyaltyRate;

    public SalesEmployee() {
    }

    public SalesEmployee(String name, int month, double monthSales, double reyaltyRate) {
        super(name, month);
        this.monthSales = monthSales;
        this.reyaltyRate = reyaltyRate;
    }

    @Override
    public double getSalary(int month) {
        if(super.month==month){
            return ((this.monthSales)*(this.reyaltyRate))+100;
        }else {
            return (this.monthSales)*(this.reyaltyRate);
        }
    }
}
